<script setup>
import CompF from '../views/CompF.vue';

defineProps({
  msg: {
    type: String,
    required: true
  },
  name:String
})

const age = ref(18)

const emits = defineEmits(['e-age']) // 定义事件
const sendData = () => {
  emits('e-age', age.value) // 触发事件，传递数据
}

</script>

<template>
  <h1>{{ msg }}，{{ name }}</h1>
  <button @click="sendData">向父组件传递数据</button>
  <hr>

  <CompF />
    
</template>

<style scoped>

</style>
